package com.project.psc.util;

import com.project.psc.dto.SupplierDto;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class GradeInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        SupplierDto supplier = SupplierThreadLocal.getSupplier();
        if (supplier.getStatus()!=1){
            response.getWriter().print("noGrade");
            return false;
        }
        return true;
    }
}
